//
//  MemoryCollectionViewCell.m
//  OurJourney
//
//  Created by 李沛池 on 2017/4/1.
//  Copyright © 2017年 Godlike. All rights reserved.
//

#import "MemoryCollectionViewCell.h"
#import "LPCDefine.h"

@implementation MemoryCollectionViewCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self creatSubView];
        
    }
    return self;
}

- (void)creatSubView
{
    _iView = [[UIImageView alloc]init];
    [self addSubview:_iView];
    
    UIVisualEffectView *visulEffectView = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
    visulEffectView.tag = 20;
    [self addSubview:visulEffectView];
}

- (void)setResourceName:(NSString *)name
{
    UIVisualEffectView *visulEffectView = (UIVisualEffectView *)[self viewWithTag:20];
    
    _iView.frame = self.bounds;
    visulEffectView.frame = CGRectMake(0, self.frame.size.height-16, self.frame.size.width, 16);
    
    NSString *imagePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"LovePictures.bundle/%@", name]];
    if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) {
        _iView.image = [UIImage imageWithContentsOfFile:imagePath];
    }else {
        imagePath = [PATH_LovePictures stringByAppendingPathComponent:name];
        _iView.image = [UIImage imageWithContentsOfFile:imagePath];
    }
}




@end
